
with open(r'D:\Users\project\python\实验4 文件操作\静夜思.txt', 'w', encoding='UTF-8') as file:
    file.write("静夜思\n李白\n床前明月光，\n疑是地上霜。\n举头望明月，\n低头思故乡。")